<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:s="http://jboss.com/products/seam/taglib"
	template="/layout/template.xhtml">

	<ui:define name="body">
		<h:form id="bookSearchForm">
			<h:panelGrid columns="1" cellpadding="0" cellspacing="0">
					<h:outputLabel for="name">Book Name</h:outputLabel>
					
					<h:inputText id="name" title="Search For Prinicipal" 
						value="#{bookQuery.books.bookName}" />
					
			</h:panelGrid>
			
			<a4j:commandButton id="submit" value="Search"
					action="#{bookMaintain.searchBook()}" reRender="books,scroller"
					eventsQueue="books" />
						
			<rich:dataTable id="books" ajax="true" width="100%" rows="15"
				height="100%" reRender="scroller" value="#{booksDataModel}"
				var="books" selectionMode="single">
				<rich:column>
					<f:facet name="header">
						Select
					</f:facet>
					<h:selectBooleanCheckbox id="bookSelected" value="#{books.selected}">
						<a4j:support event="onclick" action="#{bookMaintain.selectBook(books)}"
								reRender="books" />
					</h:selectBooleanCheckbox>
				</rich:column>
				
				<rich:column>
					<f:facet name="header">
						Book Name
					</f:facet>
					<h:outputText value="#{books.bookName}" />
				</rich:column>
				
				<rich:column>
					<f:facet name="header">
						Price
					</f:facet>
					<h:outputText value="#{books.price}" />
				</rich:column>
				
				<rich:column>
					<f:facet name="header">
						Date Created
					</f:facet>
					<h:outputText value="#{books.dateCreated}" />
				</rich:column>
				
				<rich:column>
					<f:facet name="header">
						Date Modified
					</f:facet>
					<h:outputText value="#{books.dateModified}" />
				</rich:column>
				
				<rich:column>
					<f:facet name="header">
						Detial
					</f:facet>

				</rich:column>
			</rich:dataTable>
			<rich:datascroller id="scroller" for="books" maxPages="25" />
			
			<a4j:commandButton id="confirmSelect" value="Confirm"
				action="#{bookMaintain.confirmSelectBook()}" eventsQueue="books" />
		</h:form>
	</ui:define>
</ui:composition>